var vm=new Vue({
    el: '#app',
    data: function () {
        return {
            form1: {
                company_name: "",
                contact_name: "",
                contact_phone: "",
                province: "湖北省",
                city: "武汉市",
                video_type: "企业宣传片",
                required_length: "1-3分钟",
                shoot_location: "单一场景（内景）",
                actor: "无需演员",
                animation: "无",
                budget: "",
            },
            form2: {
                company_name: "volvo",
                contact_name: "volvo",
                contact_phone: "volvo",
                province: "湖北省",
                city: "武汉市",
                plain_type: "volvo",
                page_number: "volvo",
                is_print: "volvo",
                print_number: "volvo",
                budget: "volvo",
            },
            index_modalVisible:false,
            contactus_dialog1Visble:false,
            contactus_dialog2Visble:false,
        }
    },
    methods: {
        closeIndexModal:function(){
            this.index_modalVisible=false;
        },
        openIndexModal:function(){
            this.index_modalVisible=true;
        },
        submitsuccess:function() {
            this.$notify({
              title: '成功',
              message: '恭喜您，提交成功！',
              type: 'success'
            });
          },
        submitForm1:function() {
            var xmlhttp;
            var that=this;
            if (window.XMLHttpRequest) {
                // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
                xmlhttp = new XMLHttpRequest();
            } else {
                // IE6, IE5 浏览器执行代码
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    //document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
                    that.contactus_dialog1Visble=false;
                    that.submitsuccess();
                }
            }
            xmlhttp.open("POST", hosturl+"/submitform1", true);
            xmlhttp.setRequestHeader("Content-type", "application/json");
            xmlhttp.send(JSON.stringify(that.form1));
        },
        submitForm2:function() {
            var xmlhttp;
            var that=this;
            if (window.XMLHttpRequest) {
                // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
                xmlhttp = new XMLHttpRequest();
            } else {
                // IE6, IE5 浏览器执行代码
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    //document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
                    that.contactus_dialog2Visble=false;
                    that.submitsuccess();
                }
            }
            xmlhttp.open("POST", hosturl+"/submitform2", true);
            xmlhttp.setRequestHeader("Content-type", "application/json");
            xmlhttp.send(JSON.stringify(that.form2));
        },
    },
    mounted:function() {
        setTimeout(function(){
            init();
        },500)
    },
})